# Created by: J.R. Oldroyd <fbsd@opal.com>
# $FreeBSD$

PORTNAME=	power-manager
PORTVERSION=	1.4.2
CATEGORIES=	sysutils xfce
MASTER_SITES=	${MASTER_SITE_XFCE}
MASTER_SITE_SUBDIR=	src/xfce/xfce4-${PORTNAME}/${PORTVERSION:R}
PKGNAMESUFFIX?=	-common
DISTNAME=	xfce4-${PORTNAME}-${PORTVERSION}
DIST_SUBDIR=	xfce4

MAINTAINER=	xfce@FreeBSD.org
COMMENT=	Power manager for the Xfce and LXDE Desktop

LICENSE=	GPLv2
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libnotify.so:${PORTSDIR}/devel/libnotify \
	libdbus-glib-1.so:${PORTSDIR}/devel/dbus-glib \
	libpolkit-gobject-1.so:${PORTSDIR}/sysutils/polkit \
	libupower-glib.so:${PORTSDIR}/sysutils/upower

SLAVE_PORT?=	no

GNU_CONFIGURE=	yes
USES=		gettext pkgconfig gmake libtool xfce tar:bzip2
USE_GNOME=	glib20 gtk20 intltool intlhack
USE_XFCE=	libmenu
INSTALLS_ICONS=	yes
USE_XORG=	xrandr x11 xext
CONFIGURE_ARGS=	--disable-network-manager \
		--enable-polkit \
		--enable-debug=yes

.include <bsd.port.pre.mk>

.if ${SLAVE_PORT} == no
USE_XFCE=	libmenu
CONFIGURE_ARGS+=--disable-panel-plugins
.else
RUN_DEPENDS=	xfce4-power-manager:${PORTSDIR}/sysutils/power-manager-common
.endif

.if ${SLAVE_PORT} == xfce4
USE_XFCE=	panel
CONFIGURE_ARGS+=--enable-xfce4panel --disable-lxdepanel

do-install:
	cd ${WRKSRC}/panel-plugins/power-manager-plugin/xfce && \
	${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} \
	Makefile ${MAKE_ARGS} install-pluginLTLIBRARIES
.endif

.if ${SLAVE_PORT} == lxde
RUN_DEPENDS+=	lxpanel:${PORTSDIR}/x11/lxpanel

CONFIGURE_ARGS+=--disable-xfce4panel --enable-lxdepanel

do-install:
	cd ${WRKSRC}/panel-plugins/power-manager-plugin/lxde \ 
	${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} \
	Makefile ${MAKE_ARGS} install-pluginLTLIBRARIES
.endif

.include <bsd.port.post.mk>
